module(name = "jgit")

bazel_dep(name = "rules_java", version = "8.11.0")
bazel_dep(name = "rules_jvm_external", version = "6.7")

register_toolchains("//tools:error_prone_warnings_toolchain_java17_definition")

register_toolchains("//tools:error_prone_warnings_toolchain_java21_definition")

git_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")

git_repository(
    name = "com_googlesource_gerrit_bazlets",
    commit = "f9c119e45d9a241bee720b7fbd6c7fdbc952da5f",
    remote = "https://gerrit.googlesource.com/bazlets",
)

http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
    name = "ubuntu2204_jdk17",
    sha256 = "8ea82b81c9707e535ff93ef5349d11e55b2a23c62bcc3b0faaec052144aed87d",
    strip_prefix = "rbe_autoconfig-5.1.0",
    urls = [
        "https://gerrit-bazel.storage.googleapis.com/rbe_autoconfig/v5.1.0.tar.gz",
        "https://github.com/davido/rbe_autoconfig/releases/download/v5.1.0/v5.1.0.tar.gz",
    ],
)

BOUNCYCASTLE_VERSION = "1.80"

BYTE_BUDDY_VERSION = "1.17.5"

JETTY_VERSION = "12.0.21"

JMH_VERSION = "1.37"

JNA_VERSION = "5.17.0"

SLF4J_VERSION = "1.7.36"

SSHD_VERSION = "2.15.0"

maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")
maven.install(
    name = "jgit_deps",
    artifacts = [
        "args4j:args4j:2.37",
        "com.google.code.gson:gson:2.13.1",
        "com.google.errorprone:error_prone_type_annotations:2.38.0",
        "com.googlecode.javaewah:JavaEWAH:1.2.3",
        "com.jcraft:jsch:0.1.55",
        "com.jcraft:jzlib:1.1.3",
        "commons-codec:commons-codec:1.18.0",
        "commons-io:commons-io:2.19.0",
        "commons-logging:commons-logging:1.3.5",
        "jakarta.servlet:jakarta.servlet-api:6.1.0",
        "junit:junit:4.13.2",
        "net.bytebuddy:byte-buddy-agent:" + BYTE_BUDDY_VERSION,
        "net.bytebuddy:byte-buddy:" + BYTE_BUDDY_VERSION,
        "net.java.dev.jna:jna-platform:" + JNA_VERSION,
        "net.java.dev.jna:jna:" + JNA_VERSION,
        "net.sf.jopt-simple:jopt-simple:5.0.4",
        "org.apache.commons:commons-compress:1.27.1",
        "org.apache.commons:commons-lang3:3.17.0",
        "org.apache.commons:commons-math3:3.6.1",
        "org.apache.httpcomponents:httpclient:4.5.14",
        "org.apache.httpcomponents:httpcore:4.4.16",
        "org.apache.sshd:sshd-osgi:" + SSHD_VERSION,
        "org.apache.sshd:sshd-sftp:" + SSHD_VERSION,
        "org.assertj:assertj-core:3.27.3",
        "org.bouncycastle:bcpg-jdk18on:" + BOUNCYCASTLE_VERSION,
        "org.bouncycastle:bcpkix-jdk18on:" + BOUNCYCASTLE_VERSION,
        "org.bouncycastle:bcprov-jdk18on:" + BOUNCYCASTLE_VERSION,
        "org.bouncycastle:bcutil-jdk18on:" + BOUNCYCASTLE_VERSION,
        "org.eclipse.jetty.ee10:jetty-ee10-servlet:" + JETTY_VERSION,
        "org.eclipse.jetty:jetty-http:" + JETTY_VERSION,
        "org.eclipse.jetty:jetty-io:" + JETTY_VERSION,
        "org.eclipse.jetty:jetty-security:" + JETTY_VERSION,
        "org.eclipse.jetty:jetty-server:" + JETTY_VERSION,
        "org.eclipse.jetty:jetty-session:" + JETTY_VERSION,
        "org.eclipse.jetty:jetty-util-ajax:" + JETTY_VERSION,
        "org.eclipse.jetty:jetty-util:" + JETTY_VERSION,
        "org.hamcrest:hamcrest:2.2",
        "org.mockito:mockito-core:5.18.0",
        "org.objenesis:objenesis:3.4",
        "org.openjdk.jmh:jmh-core:" + JMH_VERSION,
        "org.openjdk.jmh:jmh-generator-annprocess:" + JMH_VERSION,
        "org.slf4j:slf4j-api:" + SLF4J_VERSION,
        "org.slf4j:slf4j-simple:" + SLF4J_VERSION,
        "org.tukaani:xz:1.10",
    ],
    duplicate_version_warning = "error",
    fail_on_missing_checksum = True,
    fetch_sources = True,
    repositories = [
        "https://repo1.maven.org/maven2",
    ],
    strict_visibility = True,
)
use_repo(maven, "jgit_deps")
